<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
     
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:nya="http://desu.nya.anime">
    <h:head>
        <title>Facelet Title</title>
<h:outputStylesheet name="css/jsfcrud.css"/>
        <link rel="stylesheet" type="text/css" href="/AnimeList/resources/css/templateStyle.css"/>
    </h:head>
    <h:body>
        
<ui:composition template="/Templates/mainTemplate.xhtml">
    <ui:define name="content" >
        <h:form  enctype="multipart/form-data" id="form" >
            
            
<!--            <p:breadCrumb>
                <p:menuitem value="Home" update=":form"/>
                <p:menuitem value="#{msg.rating}" update=":form"/>
                <p:menuitem value="#{msg.database}" update=":form"/>
                <p:menuitem value="#{msg.ongoings}" actionListener="#{mBean.ongoingShow()}" update=":form"/>
                <p:menuitem value="#{msg.animeAdd}" action="animeAdd"/>
            </p:breadCrumb>-->
            <h:panelGrid rendered="#{!mBean.rendList}" columns="2" id="filterSmallAnimePanel" columnClasses="filterSet" style="width: 100%">
                <h:panelGrid columns="2" style="top: 0" id="filter">
                    <h:outputText value="#{msg.name} "/>
                    <h:inputText value="#{fltrBean.filterName}" styleClass="filterSI"/>
                    
                    <h:outputText value="#{msg.studio}: "/>
                    <h:selectOneMenu value="#{fltrBean.filterStudio}" styleClass="filterSI">
                        <f:selectItems value="#{fltrBean.studioSI}"/>
                    </h:selectOneMenu>
                    
                    <h:outputText value="#{msg.typeEd}: "/>
                    <h:selectOneMenu value="#{fltrBean.filterTypeEd}" styleClass="filterSI">
                        <f:selectItems value="#{fltrBean.typeSI}"/>
                    </h:selectOneMenu>
                    
                    <h:outputText value="#{msg.genre}: "/>
                    <h:selectOneMenu value="#{fltrBean.filterGenre}" styleClass="filterSI">
                        <f:selectItems value="#{fltrBean.genreSI}"/>
                    </h:selectOneMenu>
                    
                    <h:outputText value="#{msg.exGenre}: "/>
                    <h:selectOneMenu value="#{fltrBean.filterGenreExtra}" styleClass="filterSI">
                        <f:selectItems value="#{fltrBean.genreSI}"/>
                    </h:selectOneMenu>
                    
                    <h:outputText value="#{msg.year}: "/>
                    <h:selectOneMenu value="#{fltrBean.filterYear}" styleClass="filterSI">
                        <f:selectItems value="#{fltrBean.yearsSI}"/>
                    </h:selectOneMenu>
                    
                    <h:outputText value="#{msg.aniPerPage}: "/>
                    <h:selectOneMenu value="#{fltrBean.filterCount}" styleClass="filterSI">
                        <f:selectItem itemValue="5"/>
                        <f:selectItem itemValue="10"/>
                        <f:selectItem itemValue="15"/>
                        <f:selectItem itemValue="25"/>
                    </h:selectOneMenu>
                    <p:commandButton actionListener="#{fltrBean.filterClick()}" update=":form :leftForm" value="#{msg.filterBtn}"/>
                    <p:commandButton actionListener="#{mBean.saveAllAnimeInFile()}" value="Save BD in file"/>
                    <p:commandButton actionListener="#{mBean.restoreFromFile()}" value="Rstore BD"/>
                </h:panelGrid>
                <p:scrollPanel id="animePanel" mode="native" style="height: 520px; width: 100%">
                    <ui:repeat value="#{fltrBean.animeList}" var="anime" >
                        <h:panelGrid cellpadding="10" columns="2" styleClass="animeSmallPanel">
                            <p:graphicImage value="#{mBean.image}" >
                                <f:param name="coverId" value="#{anime.cover.id}"/>
                                <f:param name="imgMode" value="small"/>
                            </p:graphicImage>
                            <nya:animeSmallDisplay anime="#{anime}" single="false" genreList="#{mBean.getGenreListById(anime)}" coverParam="coverId"
                                           animeParam="animeId" update=":form" filterUpdate=":form:filter" animeSelect="#{mBean.animeSelect()}" image="#{(anime.cover.id)}"/>
                        </h:panelGrid>
                    
                </ui:repeat>
            </p:scrollPanel>
            </h:panelGrid>
            <p:panel rendered="#{mBean.rendList}" id="detailAnimePanel">
                <p:fieldset legend="#{mBean.selectedAnime.name}" toggleable="true" styleClass="animePanel">
                    <h:panelGrid cellpadding="10" columns="2">
                        <p:graphicImage value="#{mBean.image}">
                            <f:param name="coverId" value="#{mBean.selectedAnime.cover.id}"/>
                            <f:param name="imgMode" value="normal"/>
                        </p:graphicImage>
                        <nya:animeDisplay anime="#{mBean.selectedAnime}" single="true" rateChange="#{sessBean.rateChange()}"
                                  genreList="#{mBean.getGenreListById(selectedAnime)}" update=":form" rateValue="#{sessBean.rate}" rateBind="#{sessBean.rateBind}"
                                  onRateIconClick="voteDisplay.show()" readonly="#{sessBean.auth}" rendered="#{mBean.selectedAnime!=null}"/>
                    </h:panelGrid>
                </p:fieldset>
            </p:panel>
        </h:form>
        
        <h:form  enctype="multipart/form-data" id="dialogForm">
        <p:dialog widgetVar="voteDisplay">
                <h:panelGrid columns="1" id="voteDialog" > 
                    <h:selectOneRadio value="#{sessBean.rateInt}" layout="pageDirection">
                        <f:selectItem itemValue="1" itemLabel="1"/>
                        <f:selectItem itemValue="2" itemLabel="2"/>
                        <f:selectItem itemValue="3" itemLabel="3"/>
                        <f:selectItem itemValue="4" itemLabel="4"/>
                        <f:selectItem itemValue="5" itemLabel="5"/>
                        <f:selectItem itemValue="6" itemLabel="6"/>
                        <f:selectItem itemValue="7" itemLabel="7"/>
                        <f:selectItem itemValue="8" itemLabel="8"/>
                        <f:selectItem itemValue="9" itemLabel="9"/>
                        <f:selectItem itemValue="10" itemLabel="10"/>
                    </h:selectOneRadio>
                    <p:commandButton actionListener="#{sessBean.rateChange()}" update=":form:detailAnimePanel" oncomplete="voteDisplay.hide()"/>
                </h:panelGrid>
            </p:dialog>
        </h:form>
        
    </ui:define>
        
    </ui:composition>
        
</h:body>
</html>

